package com.hmh.Entities;

import java.util.List;

public class Post {
    private int id;
    private int blog_id;
    private Author author;
    private String body;
    private List<Tag> tags;

    private List<Comment> comments;

    public List<Comment> getComments() {
        return comments;
    }

    public void setComments(List<Comment> comments) {
        this.comments = comments;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getBlog_id() {
        return blog_id;
    }

    public void setBlog_id(int blog_id) {
        this.blog_id = blog_id;
    }

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public List<Tag> getTags() {
        return tags;
    }

    public void setTags(List<Tag> tags) {
        this.tags = tags;
    }

    public Post() {
    }

    public Post(int id, int blog_id, Author author, String body, List<Tag> tags, List<Comment> comments) {
        this.id = id;
        this.blog_id = blog_id;
        this.author = author;
        this.body = body;
        this.tags = tags;
        this.comments = comments;
    }

    @Override
    public String toString() {
        String tagString="[\n";
        if (tags!=null){
            for (Tag tag :
                    tags) {
                tagString+=tag.toString()+"\n";
            }
        }
        tagString+="]";
        String commentString="[\n";
        if (comments!=null){
            for (Comment comment :
                    comments) {
                commentString+=comment.toString()+"\n";
            }
        }
        commentString+="]";
        return "{" +
                "id=" + id +
                ", blog_id=" + blog_id +
                ", author=" + author +
                ", body='" + body + '\'' +"\n"+
                ", tags=" + tagString + "\n"+
                ", comments=" + commentString +
                '}';
    }
}
